home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / PASSDK30.ZIP;1 / DISK1.ZIP / INC / PLAY.H < prev    next >
Encoding:
Text File  |  1993-02-09  |  5.4 KB  |  214 lines

  1. /*$Author:   BCRANE  $*/
  2. /*$Date:   15 Jun 1992 10:15:58  $*/
  3. /*$Header:   W:/sccs/inc/play.h_v   1.0   15 Jun 1992 10:15:58   BCRANE  $*/
  4. /*$Log:   W:/sccs/inc/play.h_v  $
  5.  * 
  6.  *    Rev 1.0   15 Jun 1992 10:15:58   BCRANE
  7.  * Initial revision.
  8. */
  9. /*$Logfile:   W:/sccs/inc/play.h_v  $*/
  10. /*$Modtimes$*/
  11. /*$Revision:   1.0  $*/
  12. /*$Workfile:   PLAY.H  $*/
  13.  
  14. ;   /*\
  15. ;---|*|----=====< PLAY.H >====----
  16. ;---|*|
  17. ;---|*|  This module holds the various definitions for both the
  18. ;---|*|  ".WAV" and ".VOC" file contents.
  19. ;---|*|
  20. ;---|*| Copyright (c) 1991-1993, Media Vision, Inc.  All Rights Reserved.
  21. ;---|*|
  22. ;   \*/
  23.  
  24. ;   /*\
  25. ;---|*|----====< ".WAV" file definition >====----
  26. ;---|*|
  27. ;---|*|     4 bytes 'RIFF'
  28. ;---|*|     4 bytes <length>
  29. ;---|*|     4 bytes    'WAVE'
  30. ;---|*|     4 bytes      'fmt '
  31. ;---|*|     4 bytes       <length>    ; 10h - length of 'Info' block
  32. ;---|*|     2 bytes          01    ; format tag
  33. ;---|*|     2 bytes          01    ; channels (1=mono, 2=stereo)
  34. ;---|*|     4 bytes          xxxx    ; samples per second
  35. ;---|*|     4 bytes          xxxx    ; average samples per second
  36. ;---|*|     2 bytes          01/02/04    ; block alignment
  37. ;---|*|     2 bytes          08/16    ; bits per sample
  38. ;---|*|     4 bytes    'data'
  39. ;---|*|     4 bytes      <length>
  40. ;---|*|       bytes      <sample data>
  41. ;---|*|
  42. ;   \*/
  43.  
  44.     /* 4. Wave format control block                    */
  45.  
  46.         typedef struct {
  47.         int  formatTag;        /* format category        */
  48.         int  nChannels;        /* stereo/mono            */
  49.         long nSamplesPerSec;    /* sample rate            */
  50.         long nAvgBytesPerSec;    /* stereo * sample rate     */
  51.         int  nBlockAlign;        /* block alignment (1=byte)    */
  52.         int  nBitsPerSample;    /* # byte bits per sample    */
  53.     } WaveInfo;
  54.  
  55.     /* 3. Wave detailed information Block                */
  56.  
  57.     typedef struct {
  58.         char name[4];    // "fmt "
  59.         long length;
  60.         WaveInfo info;
  61.     } WaveFormat;
  62.  
  63.     /* 3. Data header which follows a WaveFormat Block            */
  64.  
  65.         typedef struct {
  66.         char name[4];    // "data"
  67.         unsigned long length;
  68.     } DataHeader;
  69.  
  70.     /* 2. Total Wave Header data in a wave file             */
  71.  
  72.         typedef struct {
  73.         char name[4];    // "WAVE"
  74.         WaveFormat fmt;
  75.         DataHeader data;
  76.     } WaveHeader;
  77.  
  78.     /* 2. Riff wrapper around the WaveFormat Block (optional)        */
  79.  
  80.     typedef struct {
  81.         char name[4];    // "RIFF"
  82.         long length;
  83.     } RiffHeader;
  84.  
  85.     /* 1. Riff wrapped WaveFormat Block                 */
  86.  
  87.     typedef struct {
  88.         RiffHeader riff;
  89.         WaveHeader wave;
  90.     } RiffWave;
  91.  
  92.  
  93. ;   /*\
  94. ;---|*|----====< Sound Blaster ".VOC" file definition >====----
  95. ;---|*|
  96. ;---|*| File Header:
  97. ;---|*|
  98. ;---|*|    VOCHDR
  99. ;---|*|
  100. ;---|*| File Data Blocks:
  101. ;---|*|
  102. ;---|*|    bVOCDATAHDR
  103. ;---|*|    bVOCDATA
  104. ;---|*|    bCONTINUE
  105. ;---|*|    bSILENCE
  106. ;---|*|    bMARKER
  107. ;---|*|    bASCII
  108. ;---|*|    bREPEAT
  109. ;---|*|    bENDREP
  110. ;---|*|    bEXTBLK
  111. ;---|*|
  112. ;   \*/
  113.  
  114.     typedef struct {
  115.         char     id[20];        /* name             */
  116.         unsigned voice_offset;    /* offset to data block     */
  117.         unsigned version;        /* version            */
  118.         unsigned check_code;    /* garbage            */
  119.     } VOCHDR;
  120.  
  121.  
  122. ;   /*\
  123. ;---|*| Data Block Structures
  124. ;   \*/
  125.  
  126.     /* types of data blocks                     */
  127.  
  128. #define TERMINATOR    0x00        /* terminator block type    */
  129. #define VOICEDATA    0x01        /* voice data block        */
  130. #define VOICECONTINUE    0x02        /* more voice data block    */
  131. #define SILENCE     0x03        /* silence period        */
  132. #define MARKER        0x04        /* marker for syncing        */
  133. #define ASCIITEXT    0x05        /* ascii zstring data        */
  134. #define REPEAT        0x06        /* repeat next blocks x times    */
  135. #define ENDREPEAT    0x07        /* end repeat marker        */
  136.  
  137.     /* Common Header to each data block                */
  138.  
  139.         typedef struct {
  140.         char btype;        /* block type            */
  141.         char bsize[3];        /* 24 bits for block size    */
  142.         } bVOCDATAHDR;
  143.  
  144.     /* voice data block (#1)                    */
  145.  
  146.         typedef struct {
  147.         char btype;        /* block type            */
  148.         char bsize[3];        /* 24 bits for block size    */
  149.         char sampler;        /* sample rate            */
  150.         char packtype;        /* packing 8/4/2.6/2 bits    */
  151.         } bVOCDATA;
  152.  
  153.     /* voice continuation (#2)                    */
  154.  
  155.         typedef struct {
  156.         char btype;        /* block type            */
  157.         char bsize[3];        /* 24 bits for block size    */
  158.         } bCONTINUE;
  159.  
  160.     /* Silence (#3)                         */
  161.  
  162.         typedef struct {
  163.         char btype;        /* block type            */
  164.         char bsize[3];        /* 24 bits for block size    */
  165.         int  period;        /* period in sample units    */
  166.         char sampler;        /* sample rate            */
  167.         } bSILENCE;
  168.  
  169.     /* Marker (#4)                            */
  170.  
  171.         typedef struct {
  172.         char btype;        /* block type            */
  173.         char bsize[3];        /* 24 bits for block size    */
  174.         int  marker;        /* marker ID            */
  175.         } bMARKER;
  176.  
  177.     /* ASCII zstring text (#5)                    */
  178.  
  179.         typedef struct {
  180.         char btype;        /* block type            */
  181.         char bsize[3];        /* 24 bits for block size    */
  182.         char text;        /* ascii zstring text        */
  183.         } bASCII;
  184.  
  185.     /* Repeat Loop (#6)                        */
  186.  
  187.         typedef struct {
  188.         char btype;        /* block type            */
  189.         char bsize[3];        /* 24 bits for block size    */
  190.         char count;        /* # of times to repeat (-1)    */
  191.         } bREPEAT;
  192.  
  193.     /* End Repeat Loop (#7)                     */
  194.  
  195.         typedef struct {
  196.         char btype;        /* block type            */
  197.         char bsize[3];        /* 24 bits for block size    */
  198.         } bENDREP;
  199.  
  200.     /* Extended Block  (#8)                     */
  201.  
  202.         typedef struct {
  203.         char btype;        /* block type            */
  204.         char bsize[3];        /* 24 bits for block size    */
  205.         int  timec;        /* time constant        */
  206.         char pack;        /* compression type        */
  207.         char mode;        /* mode: 0=mono, 1=stereo    */
  208.             } bEXTBLK;
  209.  
  210. ;   /*\
  211. ;---|*| end of PLAY.H
  212. ;   \*/
  213.  
  214.